<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table border="1">
  <caption>商品列表</caption>
  <tr>
    <th>商品标题</th>
    <th>商品价格</th>
    <th>商品销量</th>
  </tr>
</table>
<script>
  let p1={};
  p1.name='zs';
  p1.age=18;
  p1.run=function (){
    console.log(this.name+":"+this.age);
  }
  p1.run();

  let p2={
    name:"历史",
    age:18,
    run:function (){
      console.log(this.name+":"+this.age);
    }
  }

  p2.run();

  let arr=[{title:"小米手机",price:5000,saleCount:100},
    {title:"鞋",price:500,saleCount:110},
    {title:"电视",price:4000,saleCount:10},
    {title:"苹果手机",price:3000,saleCount:40},
  ]
  for (let product of arr) {
    let tr=document.createElement("tr");
    let titlrTD=document.createElement("td");
    let priceiTd=document.createElement("td");
    let saleCountTd=document.createElement("td");
    titlrTD.innerText=product.title;
    priceiTd.innerText=product.price;
    saleCountTd.innerText=product.saleCount;
    tr.append(titlrTD,priceiTd,saleCountTd);
    let table=document.querySelector("table");
    table.append(tr);
  }
</script>
</body>
</html>